﻿/**************************************************************
 * St. Sana - A file/folder scanner originall designed for    *
 * Open Media Library (open-media-library.googlecode.com)     *
 *                                                            *
 * Available for use by ANY project that wants to use it.     *
 * St. Sana is covered by the Apache 2 license.               *
 * Feel free to use this software however you like so as long *
 * as you follow the guidelines of above mentioned license.   *
 * Written by David J. Shultz (djshultz@gmail.com)            *
 **************************************************************/

using System;
using System.Collections.Generic;

namespace StSana
{
    public class Series
    {
        /// <summary>
        /// Private IList of Video objects
        /// </summary>
        IList<Video> videos;

        /// <summary>
        /// Public acess to IList of contained Video objects
        /// </summary>
        public IList<Video> Videos
        {
            get { return videos; }
        }

        /// <summary>
        /// Empty Constructor
        /// </summary>
        public Series()
        {
            videos = new List<Video>();
        }

        /// <summary>
        /// Getter/Setter for the Series Name
        /// </summary>
        public string Name
        {
            get;
            set;
        }

        /// <summary>
        /// Getter/Setter for the Series Number
        /// </summary>
        public int Number
        {
            get;
            set;
        }

        /// <summary>
        /// Add a Video object to the Series
        /// </summary>
        /// <param name="video">A valid Video object</param>
        public void Add(Video video)
        {
            videos.Add(video);
        }

        /// <summary>
        /// Removes a Video object from the Series (if it is in the Series)
        /// </summary>
        /// <param name="video">A valid Video object</param>
        /// <returns>The Video object removed, null if not removed.</returns>
        public Video Remove(Video video)
        {
            if (videos.Contains(video))
            {
                videos.Remove(video);
                return video;
            }

            return null;
        }

        /// <summary>
        /// Checks if the Series contains any Non Standard Video objects
        /// </summary>
        /// <returns>True if the Series contains 1 or more Non Standard Video objects</returns>
        public bool ContainsNonStandardVideos
        {
            get
            {
                foreach (Video v in videos)
                {
                    if (v.IsNonStandardVideo)
                        return true;
                }
                return false;
            }
        }
    }
}
